/*    */ package com.jcrj.service;
/*    */ 
/*    */ import com.jcrj.dao.WorkGroupDao;
/*    */ import com.jcrj.entity.OGroupUser;
/*    */ import com.jcrj.entity.OWorkGroup;
/*    */ import java.util.List;
/*    */ 
/*    */ public class WorkGroupService
/*    */ {
/*    */   private WorkGroupDao workGroupDao;
/*    */ 
/*    */   public WorkGroupDao getWorkGroupDao()
/*    */   {
/* 14 */     return this.workGroupDao;
/*    */   }
/*    */ 
/*    */   public void setWorkGroupDao(WorkGroupDao workGroupDao) {
/* 18 */     this.workGroupDao = workGroupDao;
/*    */   }
/*    */ 
/*    */   public void saveGroup(OWorkGroup group)
/*    */   {
/* 23 */     this.workGroupDao.saveGroup(group);
/*    */   }
/*    */ 
/*    */   public void deleteGroup(OWorkGroup group) {
/* 27 */     this.workGroupDao.deleteGroup(group);
/*    */   }
/*    */ 
/*    */   public List<OWorkGroup> getWorkGroupList(int currentPage, int userId) {
/* 31 */     String hql = "from OWorkGroup o where o.userid=" + userId;
/* 32 */     return this.workGroupDao.findByPage(hql, currentPage);
/*    */   }
/*    */ 
/*    */   public Long getWorkGroupCount(int userId) {
/* 36 */     String hql = "select count(id) from OWorkGroup where userId=" + userId;
/* 37 */     return this.workGroupDao.countTotalByHql(hql);
/*    */   }
/*    */ 
/*    */   public void deleteGroup(String[] ids)
/*    */   {
/* 42 */     if ((ids != null) && (ids.length > 0)) {
/* 43 */       String users = "";
/* 44 */       for (int i = 0; i < ids.length; i++) {
/* 45 */         if ("".equals(users))
/* 46 */           users = users + ids[i];
/*    */         else {
/* 48 */           users = users + "," + ids[i];
/*    */         }
/*    */       }
/* 51 */       String hql = "delete from OWorkGroup where id in(" + users + ")";
/* 52 */       this.workGroupDao.executeHql(hql);
/* 53 */       String hql1 = "delete from OGroupUser where groupId in (" + users + ")";
/* 54 */       this.workGroupDao.executeHql(hql1);
/*    */     }
/*    */   }
/*    */ 
/*    */   public void addgroupuser(OGroupUser groupUser) {
/* 59 */     this.workGroupDao.saveGroup(groupUser);
/*    */   }
/*    */ 
/*    */   public OWorkGroup getgroup(int id) {
/* 63 */     return (OWorkGroup)this.workGroupDao.getObject(new OWorkGroup(), id);
/*    */   }
/*    */ }

/* Location:           /Volumes/work/oa/WEB-INF/classes/
 * Qualified Name:     com.jcrj.service.WorkGroupService
 * JD-Core Version:    0.6.0
 */